FROM alpine:3.7

LABEL maintainer="Roy Kim <roy.kim@navercorp.com>"

ARG PINPOINT_VERSION=${PINPOINT_VERSION:-1.8.4}

COPY pinpoint-agent-1.8.4.tar.gz /pinpoint-agent.tar.gz
COPY /build/scripts/configure-agent.sh /usr/local/bin/

RUN mkdir -p /pinpoint-agent \
    && chmod a+x /usr/local/bin/configure-agent.sh \
    && chmod -R o+x /pinpoint-agent \
    && gunzip pinpoint-agent.tar.gz \
    && tar -xf /pinpoint-agent.tar -C /pinpoint-agent \
    && rm pinpoint-agent.tar 

VOLUME ["/pinpoint-agent"]

ENTRYPOINT ["/usr/local/bin/configure-agent.sh"]
CMD ["tail", "-f", "/dev/null"]